.\" (C) Copyright Xin Long REDHAT Corp. 2018.
.\"
.\" Permission is granted to distribute possibly modified copies
.\" of this manual provided the header is included verbatim,
.\" and in case of nontrivial modification author and date
.\" of the modification is added to the header.
.\"
.TH SCTP_RECVV 3 2018-04-29 "Linux 4.16 "Linux Programmer's Manual"
.SH NAME
sctp_recvv \- Receive a message from a SCTP socket with an extensible way.
.SH SYNOPSIS
.nf
.B #include <sys/types.h>
.B #include <sys/socket.h>
.B #include <netinet/sctp.h>
.sp
.BI "int sctp_recvv(int " sd ", const struct iovec * " iov ", int " iovlen ,
.BI "               struct sockaddr * " from ", socklen_t * " fromlen ", void * " info ,
.BI "               socklen_t * " infolen ", unsigned int * " infotype ", int * " flags );
.fi
.SH DESCRIPTION
.BR sctp_recvv
provides an extensible way for the SCTP stack to pass up different SCTP
attributes associated with a received message to an application.
There are two types of attributes that can be returned by this call: the
attribute of the received message and the attribute of the next message
in the receive buffer.  The caller enables the SCTP_RECVRCVINFO and
SCTP_RECVNXTINFO socket options, respectively, to receive these attributes.
Attributes of the received message are returned in struct sctp_rcvinfo,
and attributes of the next message are returned in struct sctp_nxtinfo.
If both options are enabled, both attributes are returned using the
following structure.

   struct sctp_recvv_rn {
     struct sctp_rcvinfo recvv_rcvinfo;
     struct sctp_nxtinfo recvv_nxtinfo;
   };

.I sd
is the socket descriptor.
.I iov
is the scatter buffer, and only one user message is returned in this buffer.
.I iovlen
is the number of elements in iov.
.I from
is a pointer to a buffer to be filled with the sender of the received message's
address.
.I fromlen
is an in/out parameter describing the from length.
.I info
is a pointer to the buffer to hold the attributes of the received message, the
structure type of info is determined by the info_type parameter.
.I infolen
is an in/out parameter describing the size of the info buffer.
On return,
.I infotype
is set to the type of the info buffer, and the current defined
values are as follows:
.TP
.B SCTP_RECVV_NOINFO
If neither SCTP_RECVRCVINFO nor SCTP_RECVNXTINFO options are enabled, no
attribute will be returned.  If only the SCTP_RECVNXTINFO option is enabled
but there is no next message in the buffer, no attribute will be returned.
In these cases, *info_type will be set to SCTP_RECVV_NOINFO.
.TP
.B SCTP_RECVV_RCVINFO
The type of info is struct sctp_rcvinfo, and the attribute relates to the
received message.
.TP
.B SCTP_RECVV_NXTINFO
The type of info is struct sctp_nxtinfo, and the attribute relates to the
next message in the receive buffer.  This is the case when only the
SCTP_RECVNXTINFO option is enabled and there is a next message in the buffer.
.TP
.B SCTP_RECVV_RN
The type of info is struct sctp_recvv_rn.  The recvv_rcvinfo field is the
attribute of the received message, and the recvv_nxtinfo field is the attribute
of the next message in the buffer.  This is the case when both SCTP_RECVRCVINFO
and SCTP_RECVNXTINFO options are enabled and there is a next message in the
receive buffer.
.PP
.I flags
is pointer to an integer to be filled with any message flags (e.g.,
MSG_NOTIFICATION).
.SH "RETURN VALUE"
On success,
.BR sctp_recvv
returns the number of bytes received or -1 if an error occurred.
.SH "SEE ALSO"
.BR sctp (7)
.BR sctp_bindx (3),
.BR sctp_connectx (3),
.BR sctp_sendmsg (3),
.BR sctp_sendv (3),
.BR sctp_send (3),
.BR sctp_peeloff (3),
.BR sctp_getpaddrs (3),
.BR sctp_getladdrs (3),
.BR sctp_opt_info (3)
